OutOfMemoryException Exception

Raised in certain cases when you run out of memory.


Notes

The OutOfMemoryException error may be raised when an operation cannot be completed due to insufficient memory. It is difficult to say when this may occur, especially since all operating systems supported by REALbasic except Mac OS "classic" use dynamic memory allocation. One possibility is when you are attempting to load a large graphics file into memory.


Example

This example uses the Catch statement in a window's Open event handler to handle out of memory exceptions when trying to draw an imported gif image. The variable myPicture is a global property of type Picture. The picture "Logo" has been added to the Project Editor.

Sub Open
Try
 myPicture= New Picture(Logo.width,Logo.height,32)
 myPicture. Graphics.DrawPicture Logo,0,0

  Catch err as OutOfMemoryException
   MsgBox "Insufficient memory to draw the picture!"
   Quit

See Also

RuntimeException class; Function, Raise statements; Nil keyword; Exception, Try blocks.